package likou;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2021/10/08 16:43
 */
public class _187 {
    public List<String> findRepeatedDnaSequences(String s) {
        List<String> list = new ArrayList<>();
        Map<String,Integer> map = new HashMap<>();
        for(int i=0;i<s.length()-10;i++){
            map.merge(s.substring(i,i+10),1,Integer::sum);
        }
        for(String key:map.keySet()){
            if(map.get(key)>1){
                list.add(key);
            }
        }
        return list;
    }
}
